package com.nd.android.u.ui;

import ims.outInterface.IGroup;

import java.util.ArrayList;

import com.nd.android.u.chatInterfaceImpl.ChatInterfaceImpl;
import com.nd.android.u.controller.bean.DefaultGroup;
import com.nd.android.u.controller.innerInterface.IGroupSupplier;

/**
 * 明星APP的群提供者
 * <br>Created 2014-9-9 下午2:32:20
 * @version  
 * @author   cb		
 * @see 	 
 */
public class StarAppGroupSupplier implements IGroupSupplier {

	@Override
	public ArrayList<IGroup> getGroupList() {
		ArrayList<IGroup> groups= ChatInterfaceImpl.INSTANCE.chatCallOtherModel.getUserGroups();
		if (groups == null || groups.isEmpty()){
			return null;
		}
		ArrayList<IGroup> iGroups=new ArrayList<IGroup>();
		for (IGroup chatgGroup : groups) {
			DefaultGroup group=new DefaultGroup(chatgGroup.getGid(),chatgGroup.getGroupType());
			iGroups.add(group);
		}
		return iGroups;
	}

	@Override
	public void loginAllGroup(ArrayList<IGroup> groups) {
        if (groups != null) {
            for (IGroup iGroup : groups) {
                iGroup.loginInit();
            }
        }
	}
}
